
<?
	   layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

<div class="row">
		<div class="col-lg-12">
				<div class="panel" >
					<div class="panel-heading">
						词表展示 <span class="subtitle">展示词表单个条目</span>
					</div>
					<div class="panel-body pan " style="width:auto;height:auto;overflow: auto;">
						<form action="#" class="form-horizontal">
							<div class="form-body pal"
								style="float:left;width:100%; overflow: auto;">
								<input id="id" type="hidden" class="form-control" />
						
								<div style="padding-bottom: 13px;">
									<label for="categoryName" class="col-md-4 control-label">
										<div align="right">
											分类名称<span class='require' >*</span>
										</div> </label>
									<div class="col-md-8">
										<div class="input-icon">
											<input id="categoryName" type="text" class="form-control" />
										</div>
									</div>
								</div>


								<div style="padding-bottom: 13px;">
									<label for="categorySid" class="col-md-4 control-label">
										<div align="right">
											分类号<span class='require'>*</span>
										</div> </label>
									<div class="col-md-8">
										<div class="input-icon">
											<input id="categorySid" type="text" class="form-control" />
										</div>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
		</div>
</div>

<?} ?>
<script>
	var index1 = window.parent.getaddupate();
	$("#id").val(index1);
	$(function() {
		if (index1 != 0) {
			demo1();
		}
	});
	function Page() {
				if($.trim($("#categoryName").val()).length<1) {
		        	alert('分类名称不能为空！');
		        	return null;
		        }
				if($.trim($("#categorySid").val()).length<1) {
		        	alert('分类号不能为空！');
		        	return null;
		        }
		       /*
		        if(isNaN($("#sort").val())){
	              alert("必须是数字");
	              return null;
	            }*/
	
		$.ajax({
			type : "post",
			url : "./generalWordCategoryAddEdit.do",
			data : {
				"id" : index1,
				"categoryName" : $("#categoryName").val(),
				"categorySid" : $("#categorySid").val(),
			},
			dataType : "json",
			async : false,
			success : function(data) {
				if(data.count>0){
					var index = parent.layer.getFrameIndex(window.name);
					window.parent.demo1();
					parent.layer.msg('提交成功');
					parent.layer.close(index);
				}
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}

	function demo1() {
		$.getJSON('./generalWordCategoryEditShow.do', {
			id : index1
		//向服务端传的参数，此处只是演示
		}, function(res) {
			//此处仅仅是为了演示变化的内容
			$("#categoryName").val(res[0].categoryName);
			$("#categorySid").val(res[0].categorySid);
		});
	};
</script>


